<?php
/*
 * 商品相关
 */
namespace app\home\controller;

use app\common\controller\IndexBase;
use think\facade\Session;
use think\facade\Db;
use app\common\model\Goods as GoodsModel;

class Good extends IndexBase
{
    protected function _initialize()
    {
        parent::_initialize();
    }

    //首页
    public function index()
    {
        $id = $this->hashids->decode($this->request->param('type'));
        !$id && $this->error('参数错误');
        $data = Db::table('goods')->field('name,goods_brief,shop_price,market_price,stock,content,img')->where('status',1)->find($id);
        $data['img'] = json_decode($data['img']);
        return $this->fetch('',['data'=>$data]);
    }


}